#ifndef _GLOBAL_
#define _GLOBAL_

/*
typedef 		signed char				int8_t;
typedef 		unsigned char			uint8_t;
typedef 		signed int				int16_t;
typedef 		unsigned int			uint16_t;
typedef 		signed long int			int32_t;
typedef 		unsigned long int		uint32_t;
//typedef         signed long long int    int64_t; 
//typedef         unsigned long long int  uint64_t; 
*/

// project/system dependent defines
#define 		FALSE					0
#define 		TRUE					1

#define 		MAX_uint8_t    			255
#define 		MAX_uint16_t			65535
#define 		MAX_uint32_t			4294967295

#define 		MIN_int8_t				-128
#define 		MAX_int8_t				127
#define 		MIN_int16_t				-32768
#define 		MAX_int16_t				32767
#define 		MIN_int32_t				-2147483648
#define 		MAX_int32_t				2147483647

// MIN/MAX/ABS macros
#define 		MIN(a,b)				((a<b)?(a):(b))
#define 		MAX(a,b)				((a>b)?(a):(b))
#define 		ABS(x)					((x>0)?(x):(-x))

// constants
#define 		PI						3.14159265359

#define			BitSet(var,bitno)		((var) |= (1U<<(bitno)))
#define			BitClr(var,bitno)		((var) &= (~(1U<<(bitno))))
#define			BitXor(var,bitno)		((var) ^= (1U<<(bitno)))
#define			BitVal(var,bitno)		((var)&(1U<<(bitno)))

#define	 		cli()					asm("cli")
#define 		sei()					asm("sei")
#define 		nop()					asm("nop")
#define 		wdr()					asm("wdr")


#endif
